import Vue from 'vue'
import Router from 'vue-router'
import Customer from "../components/page/Customer/Customer.vue";
import Register from "../components/page/Register.vue";
import Login from "../components/page/Login.vue";
import CustomerDish from "../components/page/Customer/CustomerDish.vue";
import CustomerOrder from "../components/page/Customer/CustomerOrder.vue";
import UploadAvatar from "../components/page/UploadAvatar.vue";
import ModifyPassword from "../components/page/ModifyPassword.vue";
import Admin from "../components/page/Admin/Admin.vue";
import AdminOrder from "../components/page/Admin/AdminOrder.vue";
import AdminDish from "../components/page/Admin/AdminDish.vue";
import ModifyUserName from "../components/page/ModifyUserName.vue";

Vue.use(Router)


export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/Login'
    },
    {
      path: '/Login',
      name: 'Login',
      component: Login
    },
    {
      path: '/Register',
      name: 'Register',
      component: Register
    },
    {
      path: '/Customer',
      name: 'Customer',
      component: Customer,
      children: [
        {
          path: 'CustomerDish',
          name: 'CustomerDish',
          component: CustomerDish
        },
        {
          path: 'CustomerOrder',
          name: 'CustomerOrder',
          component:CustomerOrder
        },
        {
          path: 'uploadAvatar',
          name: 'uploadAvatar',
          component: UploadAvatar
        },
        {
          path: 'modifyPassword',
          name: 'modifyPassword',
          component: ModifyPassword
        },
        {
          path: 'modifyUserName',
          name: 'modifyUserName',
          component: ModifyUserName
        }
      ]
    },
    {
      path: '/Admin',
      name: 'Admin',
      component: Admin,
      children: [
        {
          path: 'AdminDish',
          name: 'AdminDish',
          component: AdminDish
        },
        {
          path: 'AdminOrder',
          name: 'AdminOrder',
          component:AdminOrder
        },
        {
          path: 'uploadAvatar',
          name: 'uploadAvatar',
          component: UploadAvatar
        },
        {
          path: 'modifyPassword',
          name: 'modifyPassword',
          component: ModifyPassword
        },
        {
          path: 'modifyUserName',
          name: 'modifyUserName',
          component: ModifyUserName
        }
      ]
    }
  ]
})
